<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/


  defined('_JEXEC') or die('Retricted Access');
  rendfield_JS();
    JFilterOutput::objectHTMLSafe( $this->item );
    JHTML::_('behavior.tooltip');
    JHTML::_('behavior.formvalidation');
?>

<script type="text/javascript" language="javascript">
/* <![CDATA[ */
	function submitbutton(pressbutton) {
		
	
		if(pressbutton == 'apply' || pressbutton == 'save'){
	    }
	    document.resumeForm.task.value = pressbutton;
	    document.resumeForm.submit();
		
	}
	
	function usergroup_change()
	{
		if (value=document.userdetailForm.usergroup.value)
		{
			window.location = 'index.php?option=com_jajobboard&view=jausergroup&userdetail=true&group='+value;
		}
		else
		{
			window.location = 'index.php?option=com_jajobboard';
		}
		
	}
/* ]]> */
</script>
<?php 
	global  $option;
	$userdetail = JRequest::getVar('userdetail');
	$user = JFactory::getUser();
	$usertype = JRequest::getVar('group')
?>

<div id="jobboard-content">
<form name="resumeForm" class="form-validate" action="<?php echo JURI::root();?>index.php?userdetail=<?php echo $userdetail ?>" method="post" enctype="multipart/form-data">
    
    <div class="moduletable resume-box">
    	<table class="tabledata resumedetails">
			
           
            <?php
            $k=0;
                for($i = 0, $n = count($this->fieldlist); $i < $n; $i++ ){
                	$field = $this->fieldlist[$i];
                	
                	if($field->display=='admin_only' && $user->aid<2) continue;
                	
                    if($field->field_type=='SEPERATOR' && $field->display!='hide_all'){?>	
			                
	                	</table>
		    							
						<table class="tabledata resumedetails">
							<tr>
			                	<th  colspan="3">
				                    <?php echo JText::_($field->label);?>
	                    			<hr class="hr" />   
				                </th>
			                </tr>
			                				                
	               <?php }else{ ?>  
	               		<?php
                    	$edit = $this->item->id?true:false;			                        
                    	$input = rendfield($this->item, $field, false, $edit);
                    	$action = (isset($this->item->id)&&($this->item->id!=0)&&($this->item->id!=null))?'edit':'new';
				        $firstIndex = findFirstField($this->item,$this->fieldlist,$action);
						$lastIndex = findLastField($this->item,$this->fieldlist,$action);
						
                       	if ($i==$firstIndex)
				      		$classname = 'first sectiontableentry'.($k+1);
				      	elseif ($i==$lastIndex)
				      		$classname = 'last sectiontableentry'.($k+1);
				      	else 
				      		$classname = 'sectiontableentry'.($k+1);
                        ?>
	               		
	                    <?php if( ($action=='new' && $field->display=='hide_on_new') ||  ($field->display=='hide_all')){?>
			           		<?php echo $input;?>
			           	<?php }else{?>				           	
				       		 <tr class="<?php echo $classname; ?>">
				                <td class="col1">
				                <?php echo JText::_($field->label); ?>:
				                </td>
				                
				                <td class="col2">
				                   <?php echo $input;?>
				                </td>
				            </tr> 
			            <?php }?> 
		                
	                	<?php  $k = 1 - $k;
                        
	               }
	               
	              
                }
            ?>
			<!--<tr>
                <td width="30%"><?php //echo JText::_('Hot resume'); ?></td>
                <td width="70%"><?php //echo $this->lists['hotresume'];?></td>
                
            </tr>-->
            
		</table>
	
   
	    <table class="tabledata resumedetails">
	        <tr>
	            <td>
	                <input class="button" type="button" onclick="submitbutton('save');" value="<?php echo JText::_('Save'); ?>" />
	                <input class="button" type="button" onclick="submitbutton('cancel');" value="<?php echo JText::_('Cancel'); ?>" />
	            </td>
	        </tr>
	    </table>
    </div>
	
    
    <input type="hidden" name="user_id" value="<?php echo $user->id; ?>" />
    <input type="hidden" name="cid[]" value="<?php echo $this->item->id; ?>" />
    <?php
    if (!$this->item->id)
    {
    ?>
	<input type="hidden" name="created_date" value="<?php echo $this->item->created_date; ?>" />
	<?php
    }
	?>
	<input type="hidden" name="option" value="<?php echo JBCOMNAME; ?>" />
	<input type="hidden" name="view" value="jaresumes" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="boxchecked" value="1" />
    <input type="hidden" name="Itemid" value="<?php echo $this->Itemid; ?>" />
	<?php echo JHTML::_( 'form.token' ); ?>	
 </form>
</div>